
const controlFn = ($scope, $timeout, apiActions) => {
      var service = apiActions.list;
      //饼图
      $scope.$on('chartpie',(e,data) => {
        console.log(e,data);
        $timeout(() => {
            if(e.targetScope.type == 'homeclick'){    //首页点击占比
                var options = {};
                options.legendData = ['内容','消息列表','个人中心'];
                var val = [
                                {value:335, name:options.legendData[0]},
                                {value:310, name:options.legendData[1]},
                                {value:234, name:options.legendData[2]}
                            ];
                  options.legend = false; //是否显示图例
                  options.color = ['#f5bb61','#f68a63','#f66565'];
                data(val,options);
            }else if(e.targetScope.type == 'homesex'){  //性别占比
                var options = {};
                options.legendData = ['男','女'];
                var val =  [
                                {value:335, name:options.legendData[0]},
                                {value:310, name:options.legendData[1]}
                            ];
                  options.legend = false; //是否显示图例
                  options.color = ['#f5bb61','#f68a63'];
                data(val,options);
            }
        })
});
      //   //环形图 - 年龄段占比
      //   $scope.$on('circle-chart',function(e,data){
      //       console.log(e)
      //   $timeout(function(){
      //       if(e.targetScope.type == 'surveyage'){
      //           console.log("surveyage")
      //           var legendData = ['60后','70后','80后','90后','00后'];
      //           var val = [
      //                           {value:335, name:'60后'},
      //                           {value:310, name:'70后'},
      //                           {value:234, name:'80后'},
      //                           {value:135, name:'90后'},
      //                           {value:1548, name:'00后'}
      //                       ];
      //               var legend = false;
      //           e.targetScope.circleChart(data,legendData,val,legend);
      //       }
      //   })
      // });
      // //3列柱状图 - 点击情况柱状图
      // $scope.$on('chart-histogram-three',function(e,data){
      //       console.log(e)
      //   $timeout(function(){
      //       if(e.targetScope.type == 'surveyclick'){
      //           var x_data = ['9/26', '9/27', '9/28', '9/29', '9/30', '10/1', '10/2','10/3','10/4','10/5'];
      //           console.log("surveyclick")
      //           e.targetScope.histogramThreeChart(data,x_data);
      //       }
      //   })
      // });
    }

export default controlFn;